<?php
/**
* The loop that displays posts.
*/


// if there aren't any posts to be displayed
if ( ! have_posts() )
{
	echo '<h4>';
		echo __( 'No content to be displayed', 'reFresh' );
	echo '</h4>';
}

// if there are posts to be displayed:
else 
{
	
	if ( ! is_front_page() )	
		echo '<div class="content_horizontal_separator"></div>';
	
	while ( have_posts() ) : the_post();
		echo '<article class="loop_post clearfix">';
			
			if ( has_post_thumbnail() )
			{
				$thumbnail_src = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
						
				$thumbnail_size = 'w=630&amp;h=270';
				$image_source = get_template_directory_uri().'/includes/timthumb.php?src='.$thumbnail_src.'&amp;'.$thumbnail_size.'&amp;zc=1&amp;q=100';
				
				echo '<a class="post_image" href="'; the_permalink(); echo'" title="'; the_title(); echo '">';
					echo '<img src="'.$image_source.'" alt="'; echo the_title(); echo '" />';
				echo '</a>';
			}
			
			echo '<div class="post_content">';
				echo '<div class="heading">';
					echo '<a href="'; the_permalink(); echo '">';
						echo '<h3>';
							echo the_title();
						echo '</h3>';
					echo '</a>';
				echo '</div>';
				echo '<div class="text">';
					echo the_content('');
				echo '</div>';
				
				echo '<div class="read_more">';
					echo '<a href="'; the_permalink(); echo '">';
						echo '<span class="read_more_arrow"></span>';
						echo __( 'Read more', 'reFresh' );
					echo '</a>';
				echo '</div>';
				
				echo '<div class="meta clearfix">';
					echo '<div class="date">';
						echo __( 'Posted on: ', 'reFresh' ); echo get_the_date('d M Y'); 
					echo '</div>';
					
					echo '<div class="posted_by">';
						echo __( 'Posted by: ', 'reFresh' );	the_author();
					echo '</div>';
				echo '</div>';
				
			echo '</div>'; // END .post_content
			
		echo '</article>';
		
	endwhile;
	
	if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
	
} // END else

?>





